package com.handinfo.android.ui.window;

import java.io.DataInputStream;
import java.io.IOException;
import java.util.regex.Pattern;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.widget.Toast;

import com.handinfo.android.DWGameManager;
import com.handinfo.android.core.net.GameProtocol;
import com.handinfo.android.game.GameMessage;
import com.handinfo.android.ui.IUIWindows;
import com.handinfo.android.ui.UIWindows;
import com.handinfo.android.uicontrols.DWControlsManager;
import com.handinfo.android.uicontrols.DWListener;
import com.handinfo.android.uicontrols.controls.DWBackground;
import com.handinfo.android.uicontrols.controls.DWButton;
import com.handinfo.android.uicontrols.controls.DWCheckbox;
import com.handinfo.android.uicontrols.controls.DWFrame;
import com.handinfo.android.uicontrols.controls.DWImageBox;
import com.handinfo.android.uicontrols.controls.DWInputBox;
import com.handinfo.android.uicontrols.controls.DWListSubItem;
import com.handinfo.android.uicontrols.controls.DWListbox;
import com.handinfo.android.uicontrols.controls.DWTextbox;
import com.handinfo.android.uicontrols.controls.DWTitle;
//import com.handinfo.android.utils.ChannelOperation;
import com.handinfo.android.utils.Tools;

public class UIRecharge implements IUIWindows{

	private final String STR_YIDONG = "移动";
	private final String STR_LIANTONG = "联通";
//	private final String STR_DIANXIN = "电信";
	private final String STR_ZHIFUBAO = "支付宝";
	private final String STR_SHENGDA = "盛大";
	private final String STR_JUNWANG = "骏网";
	private String STR_CHANGE = STR_YIDONG;
	private int m_ok_flag = 0;//0是移动 联通 电信  1是支付宝
	private int m_zhifubao_money = 5;
	private int m_shengda_money = 5;
	private int m_junwang_money = 5;
	private int m_index = 0;
	public DWFrame m_recharge_Frame = null;
	private DWTitle m_recharge_title = null;
	private DWImageBox m_image_title = null;
	private Bitmap m_bm_title = null;
	private DWBackground m_recharge_background = null;
	private DWBackground m_background_left = null;
	private DWBackground m_background_right = null;

	private DWImageBox m_recharge_close = null;
//	private DWButton[] m_recharge_button = new DWButton[1];
//	private byte m_jilu = 0;
	private DWButton m_recharge_ok = null;

	private DWListbox m_recharge_listBox = null;
	private String[] m_str_qudao = {"移动充值","联通充值","支付宝","骏网一卡通","盛大卡"};//,"电信"
	private DWButton[] m_button_qudao = new DWButton[m_str_qudao.length];//充值形式按钮
	private DWListSubItem[] m_listItem_qudao = new DWListSubItem[m_str_qudao.length];

	private DWInputBox[] m_recharge_ib = new DWInputBox[2];
	private byte kahaoin = 0;
	private byte mimain = 1;

	public DWTextbox[] m_recharge_tb = new DWTextbox[6];
	private byte yuanbao = 0;
	public byte yuanbaoshuliang = 1;
	private byte xuanzhe = 2;
	private byte zhanghao = 3;
	private byte mima = 4;
	private byte shengming = 5;

	//额外添加
	private DWTextbox m_textBox_tishi = null;//你当前选择的充值方式
	private DWTextbox m_textBox_duihuan = null;///可以换多少
	private DWTextbox m_textBox_shengming = null; //声明注意事项
	private DWTextbox m_textBox_shuoming = null;//充值说明

	private Bitmap m_bm_close = null;
	private Bitmap m_bm_background = null;
	private Bitmap m_bm_background02 = null;
	private Bitmap m_bm_jilu = null;
	private Bitmap m_bm_anniu = null;
	private Bitmap m_bm_anniu01 = null;
	private Bitmap m_bm_anxia = null;

	private String[] m_checkBox_str = {"10元","30元","50元","100元","300元","500元"};
	private DWCheckbox[] m_recharge_checkBox = new DWCheckbox[m_checkBox_str.length];
	private DWTextbox[] m_checkBox_textBox = new DWTextbox[m_checkBox_str.length];

	private boolean flag = false;
	private boolean m_isShengda = false;

	private void recharge(){
		str = str01;
		m_recharge_Frame = new DWFrame(DWFrame.FRAME_TYPE_FULL, true);
		m_recharge_Frame.setClickClose(false);
		m_recharge_title = new DWTitle("", m_recharge_Frame);
		m_image_title = new DWImageBox(m_bm_title);
		m_image_title.setNearAnchor(m_recharge_title, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);
		//关闭窗口
		m_recharge_close = new DWImageBox(m_bm_close);
		m_recharge_close.addListener(close);
		m_recharge_close.setTouchZoomIn(20, 20);
		m_recharge_close.setNearAnchor(m_recharge_title, Tools.RIGHT_TOP,Tools.RIGHT_TOP, 0, 0);
		//背景
		m_recharge_background = new DWBackground(720, 330);
		m_recharge_background.setShow(false);
		m_recharge_background.setNearAnchor(m_recharge_Frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 5);
		//
		m_background_left = new DWBackground(250, 320);
		if(DWGameManager.AdpaterType == 2){
			m_background_left.setShowWideHigh(DWGameManager.Screen_Width*25/80, DWGameManager.Screen_Height*32/48);
		}
		m_background_left.setFill(false);
		m_background_left.setNearAnchor(m_recharge_Frame,Tools.LEFT_VCENTER, Tools.LEFT_VCENTER, 10, -10);

		m_background_right = new DWBackground(445, 320);
		if(DWGameManager.AdpaterType == 2){
			m_background_right.setShowWideHigh(DWGameManager.Screen_Width*445/800, DWGameManager.Screen_Height*32/48);
		}
		m_background_right.setFill(false);
		m_background_right.setNearAnchor(m_background_left,Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 10, 0);
		//确定
		m_recharge_ok = new DWButton("确认充值", m_bm_jilu);
		m_recharge_ok.setDownImage(m_bm_anxia);
		m_recharge_ok.addListener(m_button_ok);
		m_recharge_ok.setNearAnchor(m_recharge_Frame, Tools.RIGHT_BOTTOM, Tools.RIGHT_BOTTOM, -10, 0);

		//记录、充值
//		m_recharge_button[m_jilu] = new DWButton("充值记录", m_bm_jilu);
//		m_recharge_button[m_jilu].setDownImage(m_bm_anxia);
//		m_recharge_button[m_jilu].addListener(m_button);
//		m_recharge_button[m_jilu].setNearAnchor(m_recharge_ok, Tools.RIGHT_TOP, Tools.LEFT_TOP, -10, 0);


		//文字提示(元宝)
		m_recharge_tb[yuanbao] = new DWTextbox("当前元宝：");
		m_recharge_tb[yuanbao].setNearAnchor(m_recharge_Frame, Tools.LEFT_BOTTOM, Tools.LEFT_BOTTOM, 50, 0);
		//元宝数量
		m_recharge_tb[yuanbaoshuliang] = new DWTextbox(""+DWGameManager.getInstance().m_role.m_rmb);
		m_recharge_tb[yuanbaoshuliang].setNearAnchor(m_recharge_tb[yuanbao], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);

		//充值
		if(DWGameManager.AdpaterType == 2){
			m_recharge_listBox = new DWListbox(m_background_left.getShowWidth() - 100, m_background_left.getShowHeight() - 50);
		}else{
			m_recharge_listBox = new DWListbox(180, 300);
		}
		m_recharge_listBox.addListener(m_listBox);
		m_recharge_listBox.setLineSpacing(10);
		m_recharge_listBox.setNearAnchor(m_background_left, Tools.LEFT_TOP, Tools.LEFT_TOP, 20, 10);
		for(int i = 0;i < m_str_qudao.length;i++){
			final int index = i;
			m_listItem_qudao[i] = new DWListSubItem();
			m_button_qudao[i] = new DWButton(m_str_qudao[i], m_bm_anniu01);
			m_button_qudao[0].setBackground(m_bm_anniu, false);
//			m_button_qudao[i].setDownImage(m_bm_anniu01);
			m_button_qudao[i].setNearAnchor(m_listItem_qudao[i], Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 0);
			m_listItem_qudao[i].addControls(m_button_qudao[i]);
			m_recharge_listBox.addSubItem(m_listItem_qudao[i]);
			//监听
//			m_button_qudao[i].addListener(new DWListener() {
//
//				public void OnDoubleClick() {
//				}
//
//				public void OnClick() {
//					m_index =
//					switch(index){
//					case 0:
//						DWGameManager.getInstance().showToast("移动充值尚未开放", Toast.LENGTH_SHORT);
//						break;
//					case 1:
//						DWGameManager.getInstance().showToast("联通充值尚未开放", Toast.LENGTH_SHORT);
//						break;
//					case 2:
//						DWGameManager.getInstance().showToast("渠道1尚未开放", Toast.LENGTH_SHORT);
//						break;
//					case 3:
//						DWGameManager.getInstance().showToast("渠道2充值尚未开放", Toast.LENGTH_SHORT);
//						break;
//					}
//
//				}
//			});
		}
		//充值方式说明
		m_textBox_tishi = new DWTextbox("你选择的充值方式是：中国移动");
		m_textBox_tishi.setShow(false);
		m_textBox_tishi.setNearAnchor(m_recharge_title, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 300, 30);

		//充值提示
		m_recharge_tb[xuanzhe] = new DWTextbox("请选择您的充值面额！");
		if(DWGameManager.AdpaterType == 2){
			m_recharge_tb[xuanzhe].setNearAnchor(m_background_right, Tools.LEFT_TOP, Tools.LEFT_TOP, 100, 50);
		}else{
			m_recharge_tb[xuanzhe].setNearAnchor(m_recharge_title, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 300, 30);
		}

		//充值选项
		for(int i = 0; i < m_checkBox_str.length;i++){
			m_recharge_checkBox[i] = new DWCheckbox();
//			Tools.debugPrintln("========================="+m_recharge_checkBox[i].getShowHeight());
//			m_recharge_checkBox[i].setShowWideHigh(20, 20);

			m_checkBox_textBox[i] = new DWTextbox(m_checkBox_str[i]);
		}
		m_recharge_checkBox[0].setNearAnchor(m_recharge_tb[xuanzhe], Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 30);
		m_recharge_checkBox[1].setNearAnchor(m_recharge_checkBox[0], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox[2].setNearAnchor(m_recharge_checkBox[1], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox[3].setNearAnchor(m_recharge_checkBox[0], Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 50);
		m_recharge_checkBox[4].setNearAnchor(m_recharge_checkBox[3], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox[5].setNearAnchor(m_recharge_checkBox[4], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);

		m_recharge_checkBox[0].addListener(m_check01);
		m_recharge_checkBox[1].addListener(m_check02);
		m_recharge_checkBox[2].addListener(m_check03);
		m_recharge_checkBox[3].addListener(m_check04);
		m_recharge_checkBox[4].addListener(m_check05);
		m_recharge_checkBox[5].addListener(m_check06);

		m_checkBox_textBox[0].setNearAnchor(m_recharge_checkBox[0], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox[1].setNearAnchor(m_recharge_checkBox[1], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox[2].setNearAnchor(m_recharge_checkBox[2], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox[3].setNearAnchor(m_recharge_checkBox[3], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox[4].setNearAnchor(m_recharge_checkBox[4], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox[5].setNearAnchor(m_recharge_checkBox[5], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		//充值兑换
		m_textBox_duihuan = new DWTextbox("",400);
		m_textBox_duihuan.setNearAnchor(m_recharge_checkBox[3], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);
		//声明
		m_textBox_shengming = new DWTextbox("请您正确选择充值面额，不符将导致充值失败，可能造成充值卡失效，并可能无法找回。",400);
		m_textBox_shengming.setNearAnchor(m_textBox_duihuan, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);


		//充值卡号
		m_recharge_tb[zhanghao] = new DWTextbox("充值卡号：");
		m_recharge_tb[zhanghao].setNearAnchor(m_textBox_shengming, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 30);
		//充值密码
		m_recharge_tb[mima] = new DWTextbox("充值密码：");
		m_recharge_tb[mima].setNearAnchor(m_recharge_tb[zhanghao], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);
		//声明
//		m_recharge_tb[shengming] = new DWTextbox("郑重`声明：`你多`好多`充点，这样`你会`很强大",400,100);
//		m_recharge_tb[shengming].logic();
//		m_recharge_tb[shengming].setNearAnchor(m_recharge_tb[mima], Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 30);
		//卡号与密码的输入
		m_recharge_ib[kahaoin] = new DWInputBox(300, m_recharge_tb[zhanghao].getShowHeight(), m_recharge_Frame);
		m_recharge_ib[kahaoin].addListener(m_zhanghao);
		m_recharge_ib[kahaoin].setNearAnchor(m_recharge_tb[zhanghao], Tools.LEFT_TOP, Tools.RIGHT_TOP, 10, 0);

		m_recharge_ib[mimain] = new DWInputBox(300, m_recharge_tb[zhanghao].getShowHeight(), m_recharge_Frame);
		m_recharge_ib[mimain].addListener(m_mima);
		m_recharge_ib[mimain].setNearAnchor(m_recharge_tb[mima], Tools.LEFT_TOP, Tools.RIGHT_TOP, 10, 0);
		//说明详细
		m_textBox_shuoming = new DWTextbox("<mark c=FF0000>充值说明</mark>");
		m_textBox_shuoming.addListener(m_shuoming);
		m_textBox_shuoming.setNearAnchor(m_recharge_tb[mima], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 40);
//
//		zhifubao();
//		unShowZhiFuBao();

		m_recharge_Frame.addControl(m_recharge_background);
		m_recharge_Frame.addControl(m_background_left);
		m_recharge_Frame.addControl(m_background_right);
		m_recharge_Frame.addControl(m_recharge_title);
		m_recharge_Frame.addControl(m_image_title);
		m_recharge_Frame.addControl(m_recharge_close);
		m_recharge_Frame.addControl(m_recharge_listBox);

		m_recharge_Frame.addControl(m_textBox_duihuan);
		m_recharge_Frame.addControl(m_textBox_shengming);
		m_recharge_Frame.addControl(m_textBox_shuoming);
		m_recharge_Frame.addControl(m_textBox_tishi);
		for(int i=0; i < 6;i++){
			m_recharge_Frame.addControl(m_recharge_tb[i]);
		}
		m_recharge_Frame.addControl(m_recharge_ok);
//		m_recharge_Frame.addControl(m_recharge_button[m_jilu]);
		for(int i = 0;i < 2;i++){
			m_recharge_Frame.addControl(m_recharge_ib[i]);
		}
		for(int i = 0; i < m_checkBox_str.length;i++){
			m_recharge_Frame.addControl(m_recharge_checkBox[i]);
			m_recharge_Frame.addControl(m_checkBox_textBox[i]);
		}
		DWControlsManager.getInstance().addControl(m_recharge_Frame);
	}

	public static boolean isNumber(String str){
		  Pattern pattern = Pattern.compile("[0-9]*");
		  Tools.debugPrintln("aaaaaaaaaaaa"+pattern.matcher(str).matches());
		  if(pattern.matcher(str).matches() == false){
			  DWGameManager.getInstance().showToast("请输入数字", Toast.LENGTH_SHORT);
		  }
		  return pattern.matcher(str).matches();
		 }
	private DWListener m_zhanghao = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			if(m_isShengda == false){
				if(isNumber(m_recharge_ib[kahaoin].getText().toString()) == false){
					m_recharge_ib[kahaoin].setText(null);
				}
			}

		}
	};
	private DWListener m_mima = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			if(m_isShengda == false){
				if(isNumber(m_recharge_ib[mimain].getText().toString()) == false){
					m_recharge_ib[mimain].setText(null);
				}
			}



		}
	};


	private DWListener close = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			UIWindows.getInstance().m_recharge.close((byte)0);
		}
	};
	//渠道监听
	private DWListener m_listBox = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			refreshInput();
			int index = m_recharge_listBox.getTouchIndex();
			m_index=index;// 0：移动；1：联通；2：电信     3：支付宝  4骏一网  5盛大
			switch(index){
			case 0:
				m_ok_flag = 0;
				m_isShengda = false;
//				zhifubao();
				unChecked();
				if(m_recharge_checkBox01[0] != null){
					unShowZhiFuBao();
					unCheckedZhifubao();
				}

				STR_CHANGE = STR_YIDONG;
				str = str01;
				m_textBox_tishi.setText("你选择的充值方式是：移动充值");

				m_checkBox_textBox[0].setText("10元");
				m_checkBox_textBox[1].setText("30元");
				m_checkBox_textBox[2].setText("50元");
				m_checkBox_textBox[3].setText("100元");
				m_checkBox_textBox[4].setText("300元");
				m_checkBox_textBox[5].setText("500元");

				m_checkBox_textBox[0].setShow(true);
				m_checkBox_textBox[1].setShow(true);
				m_recharge_checkBox[0].setShow(true);
				m_recharge_checkBox[0].setTouch(true);
				m_recharge_checkBox[1].setShow(true);
				m_recharge_checkBox[1].setTouch(true);

				m_checkBox_textBox[2].setShow(true);
				m_checkBox_textBox[3].setShow(true);
				m_checkBox_textBox[4].setShow(true);
				m_checkBox_textBox[5].setShow(true);

				m_recharge_checkBox[2].setShow(true);
				m_recharge_checkBox[2].setTouch(true);
				m_recharge_checkBox[3].setShow(true);
				m_recharge_checkBox[3].setTouch(true);
				m_recharge_checkBox[4].setShow(true);
				m_recharge_checkBox[4].setTouch(true);
				m_recharge_checkBox[5].setShow(true);
				m_recharge_checkBox[5].setTouch(true);

				m_button_qudao[0].setBackground(m_bm_anniu, false);
				m_button_qudao[1].setBackground(m_bm_anniu01, false);
				m_button_qudao[2].setBackground(m_bm_anniu01, false);
				m_button_qudao[3].setBackground(m_bm_anniu01, false);
				m_button_qudao[4].setBackground(m_bm_anniu01, false);
//				m_button_qudao[5].setBackground(m_bm_anniu01, false);
				break;
			case 1:
//				zhifubao();
				m_ok_flag = 0;
				m_isShengda = false;
				unChecked();
				if(m_recharge_checkBox01[0] != null){
					unShowZhiFuBao();
					unCheckedZhifubao();
				}
				STR_CHANGE = STR_LIANTONG;
				str = str02;
				m_textBox_tishi.setText("你选择的充值方式是：联通充值");
				m_checkBox_textBox[0].setText("20元");
				m_checkBox_textBox[1].setText("30元");
				m_checkBox_textBox[2].setText("50元");
				m_checkBox_textBox[3].setText("100元");
				m_checkBox_textBox[4].setText("300元");
				m_checkBox_textBox[5].setText("500元");

				m_checkBox_textBox[0].setShow(true);
				m_checkBox_textBox[1].setShow(true);
				m_recharge_checkBox[0].setShow(true);
				m_recharge_checkBox[0].setTouch(true);
				m_recharge_checkBox[1].setShow(true);
				m_recharge_checkBox[1].setTouch(true);

				m_checkBox_textBox[2].setShow(true);
				m_checkBox_textBox[3].setShow(true);
				m_checkBox_textBox[4].setShow(true);
				m_checkBox_textBox[5].setShow(true);

				m_recharge_checkBox[2].setShow(true);
				m_recharge_checkBox[2].setTouch(true);
				m_recharge_checkBox[3].setShow(true);
				m_recharge_checkBox[3].setTouch(true);
				m_recharge_checkBox[4].setShow(true);
				m_recharge_checkBox[4].setTouch(true);
				m_recharge_checkBox[5].setShow(true);
				m_recharge_checkBox[5].setTouch(true);

				m_button_qudao[0].setBackground(m_bm_anniu01, false);
				m_button_qudao[1].setBackground(m_bm_anniu, false);
				m_button_qudao[2].setBackground(m_bm_anniu01, false);
				m_button_qudao[3].setBackground(m_bm_anniu01, false);
				m_button_qudao[4].setBackground(m_bm_anniu01, false);
//				m_button_qudao[5].setBackground(m_bm_anniu01, false);
				break;
//			case 2:
//				m_ok_flag = 0;
//				if(m_recharge_checkBox01[0] != null){
//					unShowZhiFuBao();
//				}
//				STR_CHANGE = STR_DIANXIN;
//				str = str03;
//				m_textBox_tishi.setText("你选择的充值方式是：电信充值");
//				m_checkBox_textBox[0].setText("50元");
//				m_checkBox_textBox[1].setText("100元");
//
//				m_checkBox_textBox[0].setShow(true);
//				m_checkBox_textBox[1].setShow(true);
//				m_recharge_checkBox[0].setShow(true);
//				m_recharge_checkBox[0].setTouch(true);
//				m_recharge_checkBox[1].setShow(true);
//				m_recharge_checkBox[1].setTouch(true);
//
//				m_checkBox_textBox[2].setShow(false);
//				m_checkBox_textBox[3].setShow(false);
//				m_checkBox_textBox[4].setShow(false);
//				m_checkBox_textBox[5].setShow(false);
//
//				m_recharge_checkBox[2].setShow(false);
//				m_recharge_checkBox[2].setTouch(false);
//				m_recharge_checkBox[3].setShow(false);
//				m_recharge_checkBox[3].setTouch(false);
//				m_recharge_checkBox[4].setShow(false);
//				m_recharge_checkBox[4].setTouch(false);
//				m_recharge_checkBox[5].setShow(false);
//				m_recharge_checkBox[5].setTouch(false);
//
//				m_button_qudao[0].setBackground(m_bm_anniu01, false);
//				m_button_qudao[1].setBackground(m_bm_anniu01, false);
//				m_button_qudao[2].setBackground(m_bm_anniu, false);
//				m_button_qudao[3].setBackground(m_bm_anniu01, false);
//				m_button_qudao[4].setBackground(m_bm_anniu01, false);
//				m_button_qudao[5].setBackground(m_bm_anniu01, false);
//				break;
			case 2://支付宝
				zhifubao();
				unChecked();
				m_isShengda = false;
				if(m_recharge_checkBox01[0] != null){
					unCheckedZhifubao();
				}
				m_ok_flag = 1;
				STR_CHANGE = STR_ZHIFUBAO;
				m_button_qudao[0].setBackground(m_bm_anniu01, false);
				m_button_qudao[1].setBackground(m_bm_anniu01, false);
				m_button_qudao[2].setBackground(m_bm_anniu, false);
				m_button_qudao[3].setBackground(m_bm_anniu01, false);
				m_button_qudao[4].setBackground(m_bm_anniu01, false);
//				m_button_qudao[5].setBackground(m_bm_anniu01, false);
				break;
			case 4://盛大
				m_ok_flag = 2;
				m_isShengda = true;
				STR_CHANGE = STR_SHENGDA;
				str = str04;
				unChecked();
				if(m_recharge_checkBox01[0] != null){
					unShowZhiFuBao();
					unCheckedZhifubao();
				}

				m_checkBox_textBox[0].setText("5元");
				m_checkBox_textBox[1].setText("10元");
				m_checkBox_textBox[2].setText("30元");
				m_checkBox_textBox[3].setText("50元");
				m_checkBox_textBox[4].setText("100元");

				m_checkBox_textBox[0].setShow(true);
				m_checkBox_textBox[1].setShow(true);
				m_checkBox_textBox[2].setShow(true);
				m_checkBox_textBox[3].setShow(true);
				m_checkBox_textBox[4].setShow(true);
				m_recharge_checkBox[0].setShow(true);
				m_recharge_checkBox[1].setShow(true);
				m_recharge_checkBox[2].setShow(true);
				m_recharge_checkBox[3].setShow(true);
				m_recharge_checkBox[4].setShow(true);
				m_recharge_checkBox[0].setTouch(true);
				m_recharge_checkBox[1].setTouch(true);
				m_recharge_checkBox[2].setTouch(true);
				m_recharge_checkBox[3].setTouch(true);
				m_recharge_checkBox[4].setTouch(true);

//				m_checkBox_textBox[4].setShow(false);
				m_checkBox_textBox[5].setShow(false);
//				m_recharge_checkBox[4].setShow(false);
				m_recharge_checkBox[5].setShow(false);
//				m_recharge_checkBox[4].setShow(false);
				m_recharge_checkBox[5].setShow(false);
//				m_recharge_checkBox[4].setTouch(false);
				m_recharge_checkBox[5].setTouch(false);

				m_button_qudao[0].setBackground(m_bm_anniu01, false);
				m_button_qudao[1].setBackground(m_bm_anniu01, false);
				m_button_qudao[2].setBackground(m_bm_anniu01, false);
				m_button_qudao[3].setBackground(m_bm_anniu01, false);
				m_button_qudao[4].setBackground(m_bm_anniu, false);
//				m_button_qudao[5].setBackground(m_bm_anniu01, false);
				break;
			case 3://骏一
				m_isShengda = false;
				m_ok_flag = 3;
				STR_CHANGE = STR_JUNWANG;
				str = str05;
				unChecked();
				if(m_recharge_checkBox01[0] != null){
					unShowZhiFuBao();
					unCheckedZhifubao();
				}

				m_checkBox_textBox[0].setText("5元");
				m_checkBox_textBox[1].setText("10元");
				m_checkBox_textBox[2].setText("20元");
				m_checkBox_textBox[3].setText("30元");
				m_checkBox_textBox[4].setText("50元");
				m_checkBox_textBox[5].setText("100元");

				m_checkBox_textBox[0].setShow(true);
				m_checkBox_textBox[1].setShow(true);
				m_checkBox_textBox[2].setShow(true);
				m_checkBox_textBox[3].setShow(true);
				m_checkBox_textBox[4].setShow(true);
				m_checkBox_textBox[5].setShow(true);

				m_recharge_checkBox[0].setShow(true);
				m_recharge_checkBox[1].setShow(true);
				m_recharge_checkBox[2].setShow(true);
				m_recharge_checkBox[3].setShow(true);
				m_recharge_checkBox[4].setShow(true);
				m_recharge_checkBox[5].setShow(true);

				m_recharge_checkBox[0].setTouch(true);
				m_recharge_checkBox[1].setTouch(true);
				m_recharge_checkBox[2].setTouch(true);
				m_recharge_checkBox[3].setTouch(true);
				m_recharge_checkBox[4].setTouch(true);
				m_recharge_checkBox[5].setTouch(true);

				m_button_qudao[0].setBackground(m_bm_anniu01, false);
				m_button_qudao[1].setBackground(m_bm_anniu01, false);
				m_button_qudao[2].setBackground(m_bm_anniu01, false);
				m_button_qudao[3].setBackground(m_bm_anniu, false);
				m_button_qudao[4].setBackground(m_bm_anniu01, false);
//				m_button_qudao[5].setBackground(m_bm_anniu, false);

				break;
			}
		}
	};
	//设置不被选中
	private void unChecked(){
		m_textBox_duihuan.setShow(false);
		for(int i=0;i < 6;i++){
			m_recharge_checkBox[i].setChecked(false);
		}
	}
	private void unCheckedZhifubao(){
		m_textBox_duihuan.setShow(false);
		for(int i = 0; i<9;i++){
			m_recharge_checkBox01[i].setChecked(false);
		}
	}
	//清除
	private void refreshInput(){
		m_recharge_ib[kahaoin].setText("");
		m_recharge_ib[mimain].setText("");
		unChecked();
		if(m_recharge_checkBox01[0] != null){
			unCheckedZhifubao();
		}
	}

	//确认充值
	private DWListener m_button_ok = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			if(m_ok_flag == 0){
				int money =0;
				for(int i = 0; i< 6;i++){
					if(m_recharge_checkBox[i].getChecked() == true){
						if(i == 0){
							if(STR_CHANGE == STR_YIDONG){
								money = 10;
							}else if(STR_CHANGE == STR_LIANTONG){
								money = 20;
							}
//							else if(STR_CHANGE == STR_DIANXIN){
//								money = 50;
//							}

						}else if(i == 1){
//							if(STR_CHANGE == STR_DIANXIN){
//								money = 100;
//							}else{
								money = 30;
//							}

						}else if(i == 2){
							money = 50;
						}else if(i == 3){
							money = 100;
						}else if(i == 4){
							money = 300;
						}else if(i == 5){
							money = 500;
						}
						if(!m_recharge_ib[kahaoin].getText().toString().equals("") && m_recharge_ib[kahaoin].getText() != null && !m_recharge_ib[mimain].getText().toString().equals("") && m_recharge_ib[mimain].getText() != null){
							DWGameManager.getInstance().getSendMessage().sendChongzhi(STR_CHANGE, Integer.toString(money), m_recharge_ib[kahaoin].getText(), m_recharge_ib[mimain].getText(),(byte)m_index);
							DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "订单已提交，请稍后查看充值记录");
							refreshInput();
							return;
						}else{
							DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B,"请输入卡号或者密码");
							refreshInput();
							return;
						}

					}

				}

			}else if( m_ok_flag == 1){//支付宝
				//STR_CHANGE 还是那个状态（）  m_zhifubao_money 当前选择的价格
				//注释掉。。
//				ChannelOperation.ZFBPay(m_zhifubao_money);
			}else if(m_ok_flag == 2){//盛大
				//注释掉。。
				//STR_CHANGE 还是那个状态（）  m_shengda_money 当前选择的价格
//				if(!m_recharge_ib[kahaoin].getText().toString().equals("") && m_recharge_ib[kahaoin].getText() != null && !m_recharge_ib[mimain].getText().toString().equals("") && m_recharge_ib[mimain].getText() != null){
//					ChannelOperation.isChanneSdkChongZhi=false;
//					DWGameManager.getInstance().getSendMessage().sendChongzhi(STR_CHANGE, Integer.toString(m_shengda_money), m_recharge_ib[kahaoin].getText(), m_recharge_ib[mimain].getText(),(byte)m_index);
//					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "订单已提交，请稍后查看充值记录");
//					refreshInput();
//					return;
//				}else{
//					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B,"请输入卡号或者密码");
//					refreshInput();
//					return;
//				}
			}else if(m_ok_flag == 3){//骏网
				//注释掉。。
				//STR_CHANGE 还是那个状态（）  m_junwang_money 当前选择的价格
//				if(!m_recharge_ib[kahaoin].getText().toString().equals("") && m_recharge_ib[kahaoin].getText() != null && !m_recharge_ib[mimain].getText().toString().equals("") && m_recharge_ib[mimain].getText() != null){
//					ChannelOperation.isChanneSdkChongZhi=false;
//					DWGameManager.getInstance().getSendMessage().sendChongzhi(STR_CHANGE, Integer.toString(m_junwang_money), m_recharge_ib[kahaoin].getText(), m_recharge_ib[mimain].getText(),(byte)m_index);
//					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, "订单已提交，请稍后查看充值记录");
//					refreshInput();
//					return;
//				}else{
//					DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B,"请输入卡号或者密码");
//					refreshInput();
//					return;
//				}
			}


		}
	};
	//充值记录
//	private DWListener m_button = new DWListener() {
//
//		public void OnDoubleClick() {
//		}
//
//		public void OnClick() {
////			UIWindows.getInstance().m_recharge.close((byte)0);
////			UIWindows.getInstance().m_record.open((byte)0);
//			DWGameManager.getInstance().getSendMessage().sendOpenChongZhiJiLu();
//		}
//	};
	//选择监听
	private DWListener m_check01 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setShow(true);
			if(STR_CHANGE == STR_YIDONG){
				m_textBox_duihuan.setText("10人民币可以换100元宝");
			}else if(STR_CHANGE == STR_LIANTONG){
				m_textBox_duihuan.setText("20人民币可以换200元宝");
			}
//			else if(STR_CHANGE == STR_DIANXIN){
//				m_textBox_duihuan.setText("50人民币可以换500元宝");
//			}
			else if(STR_CHANGE == STR_SHENGDA){
				m_textBox_duihuan.setText("5人民币可以换50元宝");
			}else if(STR_CHANGE == STR_JUNWANG){
				m_textBox_duihuan.setText("5人民币可以换50元宝");
			}
			m_shengda_money = 5;
			m_junwang_money = 5;
			m_recharge_checkBox[0].setChecked(true);
			m_recharge_checkBox[1].setChecked(false);
			m_recharge_checkBox[2].setChecked(false);
			m_recharge_checkBox[3].setChecked(false);
			m_recharge_checkBox[4].setChecked(false);
			m_recharge_checkBox[5].setChecked(false);
		}
	};
	// 选择监听
	private DWListener m_check02 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setShow(true);
//				if(STR_CHANGE == STR_DIANXIN){
//					m_textBox_duihuan.setText("100人民币可以换1000元宝");
//				}else
					if(STR_CHANGE == STR_SHENGDA){
					m_textBox_duihuan.setText("10人民币可以换100元宝");
				}else if(STR_CHANGE == STR_JUNWANG){
					m_textBox_duihuan.setText("10人民币可以换100元宝");
				}
				else{
					m_textBox_duihuan.setText("30人民币可以换300元宝");
				}
				m_shengda_money = 10;
				m_junwang_money = 10;
			m_recharge_checkBox[0].setChecked(false);
			m_recharge_checkBox[1].setChecked(true);
			m_recharge_checkBox[2].setChecked(false);
			m_recharge_checkBox[3].setChecked(false);
			m_recharge_checkBox[4].setChecked(false);
			m_recharge_checkBox[5].setChecked(false);
		}
	};
	// 选择监听
	private DWListener m_check03 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setShow(true);
			m_textBox_duihuan.setText("50人民币可以换500元宝");
			if(STR_CHANGE == STR_SHENGDA){
				m_textBox_duihuan.setText("30人民币可以换300元宝");
			}else if(STR_CHANGE == STR_JUNWANG){
				m_textBox_duihuan.setText("20人民币可以换200元宝");
			}
			m_shengda_money = 30;
			m_junwang_money = 20;
			m_recharge_checkBox[0].setChecked(false);
			m_recharge_checkBox[1].setChecked(false);
			m_recharge_checkBox[2].setChecked(true);
			m_recharge_checkBox[3].setChecked(false);
			m_recharge_checkBox[4].setChecked(false);
			m_recharge_checkBox[5].setChecked(false);
		}
	};
	// 选择监听
	private DWListener m_check04 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setShow(true);
			m_textBox_duihuan.setText("100人民币可以换1000元宝");
			if(STR_CHANGE == STR_JUNWANG){
				m_textBox_duihuan.setText("30人民币可以换300元宝");
			}else if(STR_CHANGE == STR_SHENGDA){
				m_textBox_duihuan.setText("50人民币可以换500元宝");
			}
			m_shengda_money = 50;
			m_junwang_money = 30;
			m_recharge_checkBox[0].setChecked(false);
			m_recharge_checkBox[1].setChecked(false);
			m_recharge_checkBox[2].setChecked(false);
			m_recharge_checkBox[3].setChecked(true);
			m_recharge_checkBox[4].setChecked(false);
			m_recharge_checkBox[5].setChecked(false);
		}
	};
	// 选择监听
	private DWListener m_check05 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setShow(true);
			m_textBox_duihuan.setText("300人民币可以换3000元宝");
			if(STR_CHANGE == STR_JUNWANG){
				m_textBox_duihuan.setText("50人民币可以换500元宝");
			}else if(STR_CHANGE == STR_SHENGDA){
				m_textBox_duihuan.setText("100人民币可以换1000元宝");
			}
			m_shengda_money = 100;
			m_junwang_money = 50;
			m_recharge_checkBox[0].setChecked(false);
			m_recharge_checkBox[1].setChecked(false);
			m_recharge_checkBox[2].setChecked(false);
			m_recharge_checkBox[3].setChecked(false);
			m_recharge_checkBox[4].setChecked(true);
			m_recharge_checkBox[5].setChecked(false);
		}
	};
	// 选择监听
	private DWListener m_check06 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setShow(true);
			m_textBox_duihuan.setText("500人民币可以换5000元宝");
			if(STR_CHANGE == STR_JUNWANG){
				m_textBox_duihuan.setText("100人民币可以换1000元宝");
			}
			m_junwang_money = 100;
			m_recharge_checkBox[0].setChecked(false);
			m_recharge_checkBox[1].setChecked(false);
			m_recharge_checkBox[2].setChecked(false);
			m_recharge_checkBox[3].setChecked(false);
			m_recharge_checkBox[4].setChecked(false);
			m_recharge_checkBox[5].setChecked(true);
		}
	};

	/**********************************************************************************充值说明界面****************************/
	private DWFrame m_say_frame = null;
	private DWTextbox m_say_text = null;
	private DWBackground m_say_backGround = null;
	private static String str01 = "中国移动充值卡`"+
							"1.支持使用序列号17位、密码18位阿拉伯数字的“中国移动”充值卡充值;`" +
							"2.目前支持10元、30元、50元、100元、300元以及500元面额的移动充值卡;`" +
							"3.卡内金额将一次全额扣除，请务必使用与您使用面额相同的移动充值卡，否则可能会导致支付不成功或支付金额丢失，我们无法帮您找回`" +
							"4.请仔细核对您的充值卡序列号和密码，如因为输入错误而导致您的充值卡失效，我们会尽力帮您找回，但仍存在无法找回的可能。`" +
							"5.请您注意，系统目前不支持任何面额的彩铃充值卡和短信充值卡，请您切勿使用相关卡片充值，以免为给您带来损失；`" +
							"6.由于网络情况，您的充值可能有些延时，一般将于1—30分钟内兑换成功，如果超过30 分钟仍然未兑换成功，请您联系在线客服！`"+
							"感谢您对我们的支持和理解！";

	private static String str02 = "中国联通充值卡`"+
							"1.支持使用序列号15位、密码19位阿拉伯数字的“中国联通”全国卡充值;`" +
							"2.目前支持20元、30元、50元、100元、300元以及500元面额的联通一卡付;`" +
							"3.卡内金额将一次全额扣除，请务必使用与您使用面额相同的移动充值卡，否则可能会导致支付不成功或支付金额丢失，我们无法帮您找回。`" +
							"4.请仔细核对您的充值卡序列号和密码，如因为输入错误而导致您的充值卡失效，我们会尽力帮您找回，但仍存在无法找回的可能。`" +
							"5.请您注意，系统目前不支持任何面额的彩铃充值卡和短信充值卡，请您切勿使用相关卡片充值，以免为给您带来损失；`" +
							"6.由于网络情况，您的充值可能有些延时，一般将于1—30分钟内兑换成功，如果超过30 分钟仍然未兑换成功，请您联系在线客服！`"+
							"感谢您对我们的支持和理解！";

	private static String str03 = "中国电信充值卡`"+
							"1.支持使用序列号19位、密码18位阿拉伯数字，卡号第四位为1的中国电信11888充值卡；`" +
							"2.目前支持50元和100元面额的电信充值卡;`" +
							"3.卡内金额将一次全额扣除，请务必使用与您使用面额相同的移动充值卡，否则可能会导致支付不成功或支付金额丢失，我们无法帮您找回`" +
							"4.请仔细核对您的充值卡序列号和密码，如因为输入错误而导致您的充值卡失效，我们会尽力帮您找回，但仍存在无法找回的可能。`" +
							"5.请您注意，系统目前不支持任何面额的彩铃充值卡和短信充值卡，请您切勿使用相关卡片充值，以免为给您带来损失；`" +
							"6.由于网络情况，您的充值可能有些延时，一般将于1—30分钟内兑换成功，如果超过30 分钟仍然未兑换成功，请您联系在线客服！`"+
							"感谢您对我们的支持和理解！";
	private static String str04 = "盛大卡`"+
						"【支持卡种】`" +
						"*卡号15位的数字字母，密码8位或者9位的阿拉伯数字。`" +
						"【支持面额】`" +
						"实卡面额：5元、10元、30元、50元、100元虚卡面额：（任意面额，不含卡密，直充）`" +
						"【温馨提示】`" +
						"请使用卡号以CSC5、CS、S、CA、CSB、YC、YD开头的“盛大互动娱乐卡”进行支付。";
	private static String str05 = "骏网一卡通`"+
						"【支持卡种】`" +
						"*卡号、密码都是16位的阿拉伯数字`" +
						"【支持面额】`" +
						"实卡面额：5元、10元、20元、30元、50元、100元虚卡面额`" +
						"【温馨提示】`" +
						"*是不能使用特定游戏专属支持卡支付的`。"+
						"特定游戏包括大唐风云、传说、蜗牛、猫扑一卡通、九鼎、雅典娜、山河等游戏。`"+
						"*在此使用的骏网一卡通，卡内剩余J点只能在易宝支付合作商家继续支付使用";
	private String str = null;
	private void shuoMing(){
		m_say_frame = new DWFrame(300, 300);
		m_say_frame.setNearAnchor(m_recharge_Frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		m_say_backGround = new DWBackground(m_bm_background, m_say_frame.getShowWidth(), m_say_frame.getShowHeight());
		m_say_backGround.setNearAnchor(m_say_frame, Tools.HCENTER_VCENTER, Tools.HCENTER_VCENTER, 0, 0);

		m_say_text = new DWTextbox(str,300,300);
		m_say_text.setNearAnchor(m_say_frame, Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 0);

		m_say_frame.addControl(m_say_backGround);
		m_say_frame.addControl(m_say_text);
		DWControlsManager.getInstance().addControl(m_say_frame);
	}
	//点击充值说明
	private DWListener m_shuoming = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			UIWindows.getInstance().m_recharge.open((byte)1);
		}
	};

	/********************************支付宝**********************************************/
	//刷新支付宝
	private String[] m_checkBox_str01 = {"5元","10元","20元","30元","50元","100元","200元","300元","500元"};
	private DWCheckbox[] m_recharge_checkBox01 = new DWCheckbox[m_checkBox_str01.length];
	private DWTextbox[] m_checkBox_textBox01 = new DWTextbox[m_checkBox_str01.length];

	private void zhifubao(){
		unShow();
		for(int i = 0; i < m_checkBox_str01.length;i++){
			m_recharge_checkBox01[i] = new DWCheckbox();
			m_checkBox_textBox01[i] = new DWTextbox(m_checkBox_str01[i]);
		}
		m_recharge_checkBox01[0].setNearAnchor(m_recharge_tb[xuanzhe], Tools.LEFT_TOP, Tools.LEFT_TOP, 0, 30);//第一排
		m_recharge_checkBox01[1].setNearAnchor(m_recharge_checkBox01[0], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox01[2].setNearAnchor(m_recharge_checkBox01[1], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox01[3].setNearAnchor(m_recharge_checkBox01[0], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);//第二排
		m_recharge_checkBox01[4].setNearAnchor(m_recharge_checkBox01[3], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox01[5].setNearAnchor(m_recharge_checkBox01[4], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox01[6].setNearAnchor(m_recharge_checkBox01[3], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);//第三排
		m_recharge_checkBox01[7].setNearAnchor(m_recharge_checkBox01[6], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
		m_recharge_checkBox01[8].setNearAnchor(m_recharge_checkBox01[7], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
//		m_recharge_checkBox01[9].setNearAnchor(m_recharge_checkBox01[6], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);//第四排
//		m_recharge_checkBox01[10].setNearAnchor(m_recharge_checkBox01[9], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);
//		m_recharge_checkBox01[11].setNearAnchor(m_recharge_checkBox01[10], Tools.LEFT_TOP, Tools.LEFT_TOP, 150, 0);

		m_recharge_checkBox01[0].addListener(m_checkBox01);
		m_recharge_checkBox01[1].addListener(m_checkBox02);
		m_recharge_checkBox01[2].addListener(m_checkBox03);
		m_recharge_checkBox01[3].addListener(m_checkBox04);
		m_recharge_checkBox01[4].addListener(m_checkBox05);
		m_recharge_checkBox01[5].addListener(m_checkBox06);
		m_recharge_checkBox01[6].addListener(m_checkBox07);
		m_recharge_checkBox01[7].addListener(m_checkBox08);
		m_recharge_checkBox01[8].addListener(m_checkBox09);
//		m_recharge_checkBox01[9].addListener(m_checkBox10);
//		m_recharge_checkBox01[10].addListener(m_checkBox11);
//		m_recharge_checkBox01[11].addListener(m_checkBox12);

		m_checkBox_textBox01[0].setNearAnchor(m_recharge_checkBox01[0], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[1].setNearAnchor(m_recharge_checkBox01[1], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[2].setNearAnchor(m_recharge_checkBox01[2], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[3].setNearAnchor(m_recharge_checkBox01[3], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[4].setNearAnchor(m_recharge_checkBox01[4], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[5].setNearAnchor(m_recharge_checkBox01[5], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[6].setNearAnchor(m_recharge_checkBox01[6], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[7].setNearAnchor(m_recharge_checkBox01[7], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
		m_checkBox_textBox01[8].setNearAnchor(m_recharge_checkBox01[8], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
//		m_checkBox_textBox01[9].setNearAnchor(m_recharge_checkBox01[9], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
//		m_checkBox_textBox01[10].setNearAnchor(m_recharge_checkBox01[10], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);
//		m_checkBox_textBox01[11].setNearAnchor(m_recharge_checkBox01[11], Tools.LEFT_VCENTER, Tools.RIGHT_VCENTER, 0, 0);

		for(int i = 0; i < m_checkBox_str01.length;i++){
			m_recharge_Frame.addControl(m_recharge_checkBox01[i]);
			m_recharge_Frame.addControl(m_checkBox_textBox01[i]);
		}

		m_textBox_duihuan.setNearAnchor(m_recharge_checkBox01[6], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);
		//声明
		m_textBox_shengming.setNearAnchor(m_textBox_duihuan, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);
	}
	//隐藏不需要的显示
	private void unShow(){
		for(int i = 0; i < m_checkBox_str.length;i++){
			m_recharge_checkBox[i].setShow(false);
			m_checkBox_textBox[i].setShow(false);

			m_recharge_checkBox[i].setTouch(false);
			m_checkBox_textBox[i].setTouch(false);
		}
		m_recharge_tb[zhanghao].setShow(false);
		m_recharge_tb[mima].setShow(false);
		m_recharge_ib[kahaoin].setShow(false);
		m_recharge_ib[mimain].setShow(false);

		m_recharge_tb[zhanghao].setTouch(false);
		m_recharge_tb[mima].setTouch(false);
		m_recharge_ib[kahaoin].setTouch(false);
		m_recharge_ib[mimain].setTouch(false);
	}
	private void unShowZhiFuBao(){
		for(int i = 0; i < m_checkBox_str01.length;i++){
			m_recharge_checkBox01[i].setShow(false);
			m_checkBox_textBox01[i].setShow(false);

			m_recharge_checkBox01[i].setTouch(false);
			m_checkBox_textBox01[i].setTouch(false);
		}
		m_recharge_tb[zhanghao].setShow(true);
		m_recharge_tb[mima].setShow(true);
		m_recharge_ib[kahaoin].setShow(true);
		m_recharge_ib[mimain].setShow(true);

		m_recharge_tb[zhanghao].setTouch(true);
		m_recharge_tb[mima].setTouch(true);
		m_recharge_ib[kahaoin].setTouch(true);
		m_recharge_ib[mimain].setTouch(true);

		m_textBox_duihuan.setNearAnchor(m_recharge_checkBox[3], Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);
		//声明
		m_textBox_shengming.setNearAnchor(m_textBox_duihuan, Tools.LEFT_TOP, Tools.LEFT_BOTTOM, 0, 10);
	}

	// 选择监听
	private DWListener m_checkBox01 = new DWListener() {

		public void OnDoubleClick() {
		}

		public void OnClick() {
			m_textBox_duihuan.setText("5人民币可以换50元宝");
			m_textBox_duihuan.setShow(true);
			m_zhifubao_money = 5;
			m_recharge_checkBox01[0].setChecked(true);
			m_recharge_checkBox01[1].setChecked(false);
			m_recharge_checkBox01[2].setChecked(false);
			m_recharge_checkBox01[3].setChecked(false);
			m_recharge_checkBox01[4].setChecked(false);
			m_recharge_checkBox01[5].setChecked(false);
			m_recharge_checkBox01[6].setChecked(false);
			m_recharge_checkBox01[7].setChecked(false);
			m_recharge_checkBox01[8].setChecked(false);
//			m_recharge_checkBox01[9].setChecked(false);
//			m_recharge_checkBox01[10].setChecked(false);
//			m_recharge_checkBox01[11].setChecked(false);

		}
	};
	// 选择监听
		private DWListener m_checkBox02 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("10人民币可以换100元宝");
				m_zhifubao_money = 10;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(true);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox03 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("20人民币可以换200元宝");
				m_zhifubao_money = 20;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(true);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox04 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("30人民币可以换300元宝");
				m_zhifubao_money = 30;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(true);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox05 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("50人民币可以换500元宝");
				m_zhifubao_money = 50;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(true);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox06 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("100人民币可以换1000元宝");
				m_zhifubao_money = 100;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(true);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox07 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("200人民币可以换2000元宝");
				m_zhifubao_money = 200;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(true);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox08 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("300人民币可以换3000元宝");
				m_zhifubao_money = 300;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(true);
				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
		// 选择监听
		private DWListener m_checkBox09 = new DWListener() {

			public void OnDoubleClick() {
			}

			public void OnClick() {
				m_textBox_duihuan.setShow(true);
				m_textBox_duihuan.setText("500人民币可以换5000元宝");
				m_zhifubao_money = 500;
				m_recharge_checkBox01[0].setChecked(false);
				m_recharge_checkBox01[1].setChecked(false);
				m_recharge_checkBox01[2].setChecked(false);
				m_recharge_checkBox01[3].setChecked(false);
				m_recharge_checkBox01[4].setChecked(false);
				m_recharge_checkBox01[5].setChecked(false);
				m_recharge_checkBox01[6].setChecked(false);
				m_recharge_checkBox01[7].setChecked(false);
				m_recharge_checkBox01[8].setChecked(true);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
			}
		};
//		// 选择监听
//		private DWListener m_checkBox10 = new DWListener() {
//
//			public void OnDoubleClick() {
//			}
//
//			public void OnClick() {
//				m_textBox_duihuan.setText("1000人民币可以换10000元宝");
//				m_zhifubao_money = 1000;
//				m_recharge_checkBox01[0].setChecked(false);
//				m_recharge_checkBox01[1].setChecked(false);
//				m_recharge_checkBox01[2].setChecked(false);
//				m_recharge_checkBox01[3].setChecked(false);
//				m_recharge_checkBox01[4].setChecked(false);
//				m_recharge_checkBox01[5].setChecked(false);
//				m_recharge_checkBox01[6].setChecked(false);
//				m_recharge_checkBox01[7].setChecked(false);
//				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(true);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(false);
//			}
//		};
//		// 选择监听
//		private DWListener m_checkBox11 = new DWListener() {
//
//			public void OnDoubleClick() {
//			}
//
//			public void OnClick() {
//				m_textBox_duihuan.setText("1500人民币可以换15000元宝");
//				m_zhifubao_money = 1500;
//				m_recharge_checkBox01[0].setChecked(false);
//				m_recharge_checkBox01[1].setChecked(false);
//				m_recharge_checkBox01[2].setChecked(false);
//				m_recharge_checkBox01[3].setChecked(false);
//				m_recharge_checkBox01[4].setChecked(false);
//				m_recharge_checkBox01[5].setChecked(false);
//				m_recharge_checkBox01[6].setChecked(false);
//				m_recharge_checkBox01[7].setChecked(false);
//				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(true);
//				m_recharge_checkBox01[11].setChecked(false);
//			}
//		};
//		// 选择监听
//		private DWListener m_checkBox12 = new DWListener() {
//
//			public void OnDoubleClick() {
//			}
//
//			public void OnClick() {
//				m_textBox_duihuan.setText("2000人民币可以换20000元宝");
//				m_zhifubao_money = 2000;
//				m_recharge_checkBox01[0].setChecked(false);
//				m_recharge_checkBox01[1].setChecked(false);
//				m_recharge_checkBox01[2].setChecked(false);
//				m_recharge_checkBox01[3].setChecked(false);
//				m_recharge_checkBox01[4].setChecked(false);
//				m_recharge_checkBox01[5].setChecked(false);
//				m_recharge_checkBox01[6].setChecked(false);
//				m_recharge_checkBox01[7].setChecked(false);
//				m_recharge_checkBox01[8].setChecked(false);
//				m_recharge_checkBox01[9].setChecked(false);
//				m_recharge_checkBox01[10].setChecked(false);
//				m_recharge_checkBox01[11].setChecked(true);
//			}
//		};
//

	public void init() {
		m_bm_close = UIWindows.createImage("/img/newui/fanhuianniu_1.gnp");
		m_bm_title = UIWindows.createImage("/img/newui/yuanbaochnogzhi.gnp");
		m_bm_background = UIWindows.createImage("/img/newui/beibaobj_2.gnp");
//		m_bm_background02 = UIWindows.createImage("/img/newui/yaoqianshuxbjk_1.gnp");
		m_bm_jilu = UIWindows.createImage("/img/newui/anniu_6.gnp");
		m_bm_anxia = UIWindows.createImage("/img/newui/anniu_6ax.gnp");
		m_bm_anniu = UIWindows.createImage("/img/newui/anniu_4.gnp");//充值渠道按钮
		m_bm_anniu01 = UIWindows.createImage("/img/newui/anniu_4ax.gnp");

	}

	public void open(byte index) {
		if(index == 0){
			if(flag == false){
				recharge();
				flag = true;
			}else{
				if(m_recharge_Frame != null){
					DWControlsManager.getInstance().addControl(m_recharge_Frame);
				}else{
					return;
				}
			}
		}else if(index == 1){
			shuoMing();
		}


	}

	public void close(byte index) {
		m_ok_flag = 0;
		flag = false;
		m_isShengda = false;
		DWControlsManager.getInstance().removeControl(m_recharge_Frame);
	}

	public void dispose() {
	}

	public void logic()
	{
		// TODO Auto-generated method stub

	}
	public  void recvChongZhi(DataInputStream dis) throws IOException
	{
		DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_充值);
		Tools.debugPrintln("充值返回！");
		byte state = dis.readByte();
		String info = dis.readUTF();
		if (!info.equals("")) {
			DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_D, info);
		}
		if (state == 1) {
//			UIChongzhi chongzhi = (UIChongzhi) UIManager.getInstance().getWindowById(UIWindowFactory.WINDOW_CHNGZHI);
//			chongzhi.close();
		}
	}
	public void recvChongzhiRecord(DataInputStream dis) throws IOException {
		DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_充值);
		byte state = dis.readByte();
		String info = dis.readUTF();
		if (state == 0) {
			if (!info.equals("")) {
				DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, info);
				return;
			}
		}
		m_yuanbao_yue = dis.readLong();
		int num = dis.readInt();
		if (num == 0) {
			return;
		}
		m_chongzhi_records = new String[num][];
		for (int i = 0; i < num; i++) {
			int num_att = dis.readInt();
			m_chongzhi_records[i] = new String[num_att];
			for (int j = 0; j < num_att; j++) {
				m_chongzhi_records[i][j] = dis.readUTF();
			}
		}
	}
	public void recvConsumeRecord(DataInputStream dis) throws IOException {
		DWGameManager.getInstance().getSendMessage().unlockNetwork(GameMessage.锁_充值);
		byte state = dis.readByte();
		String info = dis.readUTF();
		if (state == 0) {
			if (!info.equals("")) {
				DWGameManager.getInstance().addSystemInfo(DWGameManager.SYSTEM_INFO_TYPE_B, info);
				return;
			}
		}
		m_yuanbao_consum = dis.readLong();
		int num = dis.readInt();
		if (num == 0) {
			return;
		}
		m_consume_records = new String[num][];
		for (int i = 0; i < num; i++) {
			int num_att = dis.readInt();
			m_consume_records[i] = new String[num_att];
			for (int j = 0; j < num_att; j++) {
				m_consume_records[i][j] = dis.readUTF();
			}
		}
	}
	private String[][] m_chongzhi_records;
	private String[][] m_consume_records;
	private long m_yuanbao_yue;// 元宝余额
	private long m_yuanbao_consum;// 消费金额
}
